package com.max.sportmanage.controller;

import com.max.sportmanage.common.Result;
import com.max.sportmanage.entity.SysPermission;
import com.max.sportmanage.service.SysPermissionService;
import com.max.sportmanage.util.QueryInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: java-sport-manage
 * @description:
 * @author: max-qaq
 * @create: 2021-11-15 22:33
 **/
@RestController
@RequestMapping("/permission")
@Slf4j
public class SysPermissionController {
    @Autowired
    SysPermissionService sysPermissionService;

    @PostMapping("/findPage")
    public Result findPage(
            @RequestBody QueryInfo queryInfo
            ){
        return sysPermissionService.findPage(queryInfo);
    }

    @PostMapping("/insert")
    public Result insert(
            @RequestBody SysPermission sysPermission
            ){
        return sysPermissionService.insert(sysPermission);
    }

    @PostMapping("/update")
    public Result update(
            @RequestBody SysPermission sysPermission
    ){
        return sysPermissionService.update(sysPermission);
    }

    @PutMapping("/delete/{id}")
    public Result delete(
            @PathVariable long id
    ){
        log.info("进行删除操作");
        return sysPermissionService.delete(id);
    }
}
